package org.ttitfly.workflow.engine.persistence.hibernate;

import org.hibernate.Session;
import org.springframework.stereotype.Component;
import org.springside.modules.orm.hibernate.HibernateDao;
import org.ttitfly.workflow.engine.run.ProcessInstance;
import org.ttitfly.workflow.engine.run.Task;


/**
 * 
 * @author panhaichun
 *
 */
@Component
public class HibernateProcessInstanceDao extends HibernateDao<ProcessInstance, Integer> {

	@Override
	public void delete(Integer id) {
		Session session = super.getSession();
		session.createQuery("DELETE " + Task.class.getName() + " WHERE processInstance.id = ?").setInteger(0, id).executeUpdate();
		super.delete(id);
	}

}
